package com.central.test

import com.central.service.{LingerCondition, LingerService}
import com.central.utils.ConfigUtil
import org.apache.spark.sql.SparkSession

object TestLinger {
  def main(args: Array[String]): Unit = {
    val incidentDay = "2020-03-09"
    val jobId = 5
    val hasCriminalRecord=0
    val lingerCount="3,6"
    val codeType="imsi"
    val lingerDay="2020-03-02,2020-03-11"
    val lingerTime="09:48:06-13:48:06"
    val hasGang=1
    val incidentTime="10:48:06-12:48:06"
    val deviceCodes="26,29,2,3,1"

val condition = LingerCondition(jobId,codeType,incidentDay,incidentTime,hasCriminalRecord,hasGang,deviceCodes,lingerDay,lingerTime,lingerCount)
    val para1 = SparkSession
      .builder()
      .appName("testLinger")
      .master("local")
      .config("es.nodes", ConfigUtil.properties.getProperty("elasticsearch.host", "192.168.5.180"))
      .config("es.port", ConfigUtil.properties.getProperty("elasticsearch.port", "9200"))
      .config("es.mapping.date.rich", "false")

      .getOrCreate()
    para1.sparkContext.setLogLevel("ERROR")
    new LingerService().lingerAnalysis(para1,condition)
  }
}
